﻿using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class testing_test1 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       //Response.Write(findlastnum("abc1xy1"));
        //char[] arr = test1.ToCharArray();
        //Array.Reverse(arr);
        //test1 = new string(arr);
        //int count = 0;
        //foreach (char ch in test1.ToCharArray())
        //{
        //    if (char.IsNumber(ch))
        //    {
        //        count++;
        //    }
        //    else
        //    {
        //        break;
        //    }
        //}
        //Response.Write(test1.Substring(0,count));

       
       // findlastnum("abc1xy1");
    }

    private string findlastnum(string str)
    {
        for (int i =0;i<str.Length; i++)
        {
            if (char.IsNumber(str[i]))
            {
                str = str.Substring(str.IndexOf(str[i]));
                break;
            }
         }
        Regex RgxUrl = new Regex("[a-zA-Z]");
        if (RgxUrl.IsMatch(str))
        {
            str = str.Substring(1);
            return (findlastnum(str));
        }
        else
        {
            return str;
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
       Response.Write(findlastnum("abc123xy134"));
    }
    protected void Button1_Click1(object sender, EventArgs e)
    {
        Response.Write(findlastnum("abc123xy134"));
    }
}
